
{***************************************************************}
{                                                               }
{                       XML Data Binding                        }
{                                                               }
{         Generated on: 2005-12-1 11:44:06                      }
{       Generated from: F:\project\lw\QueryIt\bin\history.xml   }
{                                                               }
{***************************************************************}

unit XmlHistory;

interface

uses xmldom, XMLDoc, XMLIntf;

type

{ Forward Decls }

  IXMLHistoryType = interface;
  IXMLControlType = interface;

{ IXMLHistoryType }

  IXMLHistoryType = interface(IXMLNodeCollection)
    ['{5B8C6DCE-1863-4081-AA4D-3D9A1ED3AD84}']
    { Property Accessors }
    function Get_MaxValueCount: Integer;
    function Get_Control(Index: Integer): IXMLControlType;
    procedure Set_MaxValueCount(Value: Integer);
    { Methods & Properties }
    function Add: IXMLControlType;
    function Insert(const Index: Integer): IXMLControlType;
    property MaxValueCount: Integer read Get_MaxValueCount write Set_MaxValueCount;
    property Control[Index: Integer]: IXMLControlType read Get_Control; default;
  end;

{ IXMLControlType }

  IXMLControlType = interface(IXMLNode)
    ['{E72181F5-B94D-4A4A-9A70-2499BF245791}']
    { Property Accessors }
    function Get_Catalog: WideString;
    function Get_HashId: WideString;
    function Get_ValuesList: WideString;
    procedure Set_Catalog(Value: WideString);
    procedure Set_HashId(Value: WideString);
    procedure Set_ValuesList(Value: WideString);
    { Methods & Properties }
    property Catalog: WideString read Get_Catalog write Set_Catalog;
    property HashId: WideString read Get_HashId write Set_HashId;
    property ValuesList: WideString read Get_ValuesList write Set_ValuesList;
  end;

{ Forward Decls }

  TXMLHistoryType = class;
  TXMLControlType = class;

{ TXMLHistoryType }

  TXMLHistoryType = class(TXMLNodeCollection, IXMLHistoryType)
  protected
    { IXMLHistoryType }
    function Get_MaxValueCount: Integer;
    function Get_Control(Index: Integer): IXMLControlType;
    procedure Set_MaxValueCount(Value: Integer);
    function Add: IXMLControlType;
    function Insert(const Index: Integer): IXMLControlType;
  public
    procedure AfterConstruction; override;
  end;

{ TXMLControlType }

  TXMLControlType = class(TXMLNode, IXMLControlType)
  protected
    { IXMLControlType }
    function Get_Catalog: WideString;
    function Get_HashId: WideString;
    function Get_ValuesList: WideString;
    procedure Set_Catalog(Value: WideString);
    procedure Set_HashId(Value: WideString);
    procedure Set_ValuesList(Value: WideString);
  end;

{ Global Functions }

function Gethistory(Doc: IXMLDocument): IXMLHistoryType;
function Loadhistory(const FileName: WideString): IXMLHistoryType;
function Newhistory: IXMLHistoryType;

const
  TargetNamespace = '';

implementation

{ Global Functions }

function Gethistory(Doc: IXMLDocument): IXMLHistoryType;
begin
  Result := Doc.GetDocBinding('history', TXMLHistoryType, TargetNamespace) as IXMLHistoryType;
end;

function Loadhistory(const FileName: WideString): IXMLHistoryType;
begin
  Result := LoadXMLDocument(FileName).GetDocBinding('history', TXMLHistoryType, TargetNamespace) as IXMLHistoryType;
end;

function Newhistory: IXMLHistoryType;
begin
  Result := NewXMLDocument.GetDocBinding('history', TXMLHistoryType, TargetNamespace) as IXMLHistoryType;
end;

{ TXMLHistoryType }

procedure TXMLHistoryType.AfterConstruction;
begin
  RegisterChildNode('control', TXMLControlType);
  ItemTag := 'control';
  ItemInterface := IXMLControlType;
  inherited;
end;

function TXMLHistoryType.Get_MaxValueCount: Integer;
begin
  Result := AttributeNodes['maxValueCount'].NodeValue;
end;

procedure TXMLHistoryType.Set_MaxValueCount(Value: Integer);
begin
  SetAttribute('maxValueCount', Value);
end;

function TXMLHistoryType.Get_Control(Index: Integer): IXMLControlType;
begin
  Result := List[Index] as IXMLControlType;
end;

function TXMLHistoryType.Add: IXMLControlType;
begin
  Result := AddItem(-1) as IXMLControlType;
end;

function TXMLHistoryType.Insert(const Index: Integer): IXMLControlType;
begin
  Result := AddItem(Index) as IXMLControlType;
end;

{ TXMLControlType }

function TXMLControlType.Get_Catalog: WideString;
begin
  Result := AttributeNodes['catalog'].Text;
end;

procedure TXMLControlType.Set_Catalog(Value: WideString);
begin
  SetAttribute('catalog', Value);
end;

function TXMLControlType.Get_HashId: WideString;
begin
  Result := AttributeNodes['hashId'].Text;
end;

procedure TXMLControlType.Set_HashId(Value: WideString);
begin
  SetAttribute('hashId', Value);
end;

function TXMLControlType.Get_ValuesList: WideString;
begin
  Result := AttributeNodes['valuesList'].Text;
end;

procedure TXMLControlType.Set_ValuesList(Value: WideString);
begin
  SetAttribute('valuesList', Value);
end;

end.